var t = getApp();

Page({
    data: {
        ht: {},
        url2: "",
        id: "",
        sessin: "",
        From: ""
    },
    onLoad: function(a) {
        var i = this, s = a.id, e = a.url, o = (a.url2, t.globalData.htGet);
        s == o.id && e == o.url && "Examhtong/Examhtong/ContractDetail" !== e ? this.setData({
            ht: o
        }) : (wx.showToast({
            title: "数据加载中",
            icon: "loading",
            duration: 2e4
        }), wx.request({
            url: t.url + "addon/" + e,
            data: {
                id: s
            },
            method: "GET",
            header: {
                "Content-Type": "application/json",
                Cookie: "PHPSESSID=" + wx.getStorageSync("PHPSESSID")
            },
            success: function(s) {
                i.setData({
                    ht: s.data
                }), t.globalData.htGet = s.data, t.globalData.htGet.url = a.url, wx.hideToast();
            },
            fail: function(t) {
                wx.hideToast(), wx.showToast({
                    title: "无法连接网络",
                    icon: "loading",
                    duration: 2200
                });
            }
        })), this.setData({
            url: a.url,
            url2: a.url2,
            id: a.id,
            sessin: a.sessin,
            From: a.From,
            Listurl: a.Listurl,
            TopName: a.TopName
        });
    },
    edit: function() {
        var t = this.data.url, a = this.data.url2, i = this.data.id, s = this.data.sessin;
        wx.redirectTo({
            url: "../Modeledit/Modeledit?&url=" + t + "&url2=" + a + "&id=" + i + "&sessin=" + s
        });
    },
    onShareAppMessage: function(t) {
        var a = this.data.Listurl, i = this.data.TopName, s = this.data.sessin, e = this.data.From;
        return {
            title: this.data.ht.title,
            path: "/pages/Modelht2/Modelht2?id=" + this.data.id + "&url=" + this.data.url + "&url2=" + this.data.url2 + "&sessin=" + s + "&Listurl=" + a + "&TopName=" + i + "&From=" + e,
            success: function(t) {
                console.log(t);
            },
            fail: function(t) {}
        };
    },
    toIndex: function() {
        var a = this.data.sessin, i = wx.getStorageSync("PHPSESSID"), s = (this.data.url, 
        this.data.From, "Modelstr_" + this.data.id);
        a ? a == i ? wx.navigateBack({
            delta: -1
        }) : t.globalData[s] ? wx.navigateBack({
            delta: -1
        }) : wx.switchTab({
            url: "../Draft/Draft"
        }) : t.globalData[s] ? wx.redirectTo({
            url: "../Model/Model"
        }) : wx.switchTab({
            url: "../Draft/Draft"
        });
    }
});